package cn.wolfcode.wechat.vo;

import lombok.Getter;
import lombok.Setter;

/**
 * 获取系统凭证
 */
@Getter
@Setter
public class AccessTokenVo {
    /**
     * 接口使用凭证
     */
    private String access_token;
    /**
     * 过期事件:单位秒(s)
     */
    private Long expires_in;
    /**
     * 创建时间
     */
    private Long createTime;

    public boolean isAccessTokenValid() {
        if (expires_in != null) {
            long deadline = createTime + expires_in * 1000;
            return deadline > System.currentTimeMillis();
        }
        return false;
    }
}
